<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<ui:composition>
	<h:panelGrid id="messageLocationInputPanel" columns="1"
		style="width:100%">
		<h:panelGrid columns="2" style="width:100%">
			<p:commandButton oncomplete="locationDlg.show()" ajax="true"
				update=":dialogForm" icon="add"
				actionListener="#{locationController.init}" value="Add"
				title="Add users" style="float:left"></p:commandButton>
			<p:commandButton
				value="Send this message to user(s) of following location"
				ajax="true"
				actionListener="#{messageController.sendCurrentToLocations}"
				update=":headerForm"
				disabled="#{!messageModel.current.isHaveLocation}"
				style="float:right"></p:commandButton>
		</h:panelGrid>
		<p:dataTable var="location" value="#{messageModel.current.locations}"
			paginator="true" rows="15"
			rowsPerPageTemplate="5,7,10,15,20,30,40,50"
			paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}">
			<f:facet name="header"> List of user</f:facet>
			<p:column style="width:20px">
				<f:facet name="header">
					<p:commandButton icon="delete" ajax="true" update=":detailForm"
						style="float:right"
						actionListener="#{messageController.removeSelectedLocationsFromCurrent}"></p:commandButton>
				</f:facet>
				<p:selectBooleanCheckbox value="#{location.selected}"></p:selectBooleanCheckbox>
			</p:column>
			<p:column headerText="id" sortBy="#{location.id}"
				filterBy="#{location.id}" filterMatchMode="contains">
				<h:outputText value="#{location.id}" />
			</p:column>
			<p:column headerText="Number" sortBy="#{location.number}"
				filterBy="#{location.number}" filterMatchMode="contains">
				<h:outputText value="#{location.number}" />
			</p:column>
			<p:column headerText="Name" sortBy="#{location.name}"
				filterBy="#{location.name}" filterMatchMode="contains">
				<h:outputText value="#{location.name}" />
			</p:column>
			<p:column headerText="Address" sortBy="#{location.address}"
				filterBy="#{location.address}" filterMatchMode="contains">
				<h:outputText value="#{location.address}" />
			</p:column>
			<p:column headerText="Telephone" sortBy="#{location.telephone}"
				filterBy="#{location.telephone}" filterMatchMode="contains">
				<h:outputText value="#{location.telephone}" />
			</p:column>
		</p:dataTable>
	</h:panelGrid>

</ui:composition>

</html>